#ifndef _BOSS_3_DOOR_ENTITY_H_
#define _BOSS_3_DOOR_ENTITY_H_

#include "Boss3DoorData.h"
#include "AbstractEntity.h"

class Boss3DoorEntity : public AbstractEntity
{
public:
	int life;
	int fireCounter;
	Boss3DoorEntity()
	{
		_data = new Boss3DoorData(-1, _ID_MAP_STAGE3_BOSS_DOOR_1);
		_data->canInteract = false;
		_data->isDead = false;
		fireCounter = 100;
		life = 8;
	}

	virtual void update(long time){
		if (_data->isDead && fireCounter > 0) {
			fireCounter--;
			if (fireCounter == 50) {
				_data->sprites->currentSprite->setIndex(1);
				EffectManager::getInstatnse()->createEffect(EffectType::TYPE_Object_Fire, _data->getRect()->X, _data->getRect()->Y - 20);
			} else if (fireCounter == 5) {
				_data->sprites->currentSprite->setIndex(2);
				EffectManager::getInstatnse()->createEffect(EffectType::TYPE_Object_Fire, _data->getRect()->X, _data->getRect()->Y + 20);
			} else if (fireCounter == 0) {
				GameDeviceSingleton::getInstance()->setCurrentMapLevel(1);
			}
		}
	}

	virtual void draw(long time){
		_data->sprites->draw();
	}

	virtual AbstractData* getAbstractData()
	{
		return _data;
	}

	virtual void updateData(int action, int actiondata) {
		life -= actiondata;
		if (life <= 0) {
			_data->canInteract = false;
			_data->isDead = true;
		}
	}

	~Boss3DoorEntity();

private:
	Boss3DoorData* _data;
};
#endif